import math
type
  Resistor* = enum
    Black= 0
    Brown= 1
    Red= 2
    Orange= 3
    Yellow= 4
    Green= 5
    Blue= 6
    Violet= 7
    Grey= 8
    White= 9

proc value*(colors: openArray[Resistor]): int = 
  (colors[0].ord * 10 + colors[1].ord) * 10 ^ colors[2].ord

proc unit*(value: int): (int, string) = 
  if value mod 1000 == 0: (value div 1000, "kiloohms")
  else: (value, "ohms")

proc label*(colors: openArray[Resistor]): (int, string) =
  colors.value.unit